<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>客户区域管理</title>
	<meta name="decorator" content="default"/>
    <link href="${ctxStatic}/bootstrap-slider/css/bootstrap-slider.min.css" type="text/css" rel="stylesheet"/>
    <script type="text/javascript" src="${ctxStatic}/bootstrap-slider/bootstrap-slider.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
            $("#sortOrder").slider({
               step: 1,
               min: 1,
               max: 999,
               value:parseInt('${region.sortOrder}'),
               formatter: function(value) {
                   return '当前排序为: ' + value;
               }
            });

		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/sys/region/">客户区域列表</a></li>
		<li class="active"><a href="${ctx}/sys/region/form?id=${region.id}">客户区域<shiro:hasPermission name="sys:region:edit">${not empty region.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="sys:region:edit">查看</shiro:lacksPermission></a></li>
        <li><a href="${ctx}/sys/region/listAdmin">固定区域列表</a></li>
    </ul><br/>
	<form:form id="inputForm" modelAttribute="region" action="${ctx}/sys/region/save" method="post" class="form-horizontal">
		<form:hidden path="id"/>
		<form:hidden path="historyFlag"/>
		<sys:message content="${message}" onMessage="false"/>

		<div class="control-group">
			<label class="control-label">名称：</label>
			<div class="controls">
				<form:input path="regionName" htmlEscape="false" maxlength="32" class="input-xlarge "/>
			</div>
		</div>
        <div class="control-group">
            <label class="control-label">排序：</label>
            <div class="controls" style="overflow: visible">
                <form:input id="sortOrder" path="sortOrder" htmlEscape="false" maxlength="32" class="input-xlarge "/>
            </div>
        </div>

        <c:if test="${not empty region.id}">
            <div class="control-group">
                <label class="control-label">创建时间：</label>
                <div class="controls">
                    <fmt:formatDate value="${region.dateCreated}" pattern="yyyy-MM-dd HH:mm:ss"/>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">更新时间：</label>
                <div class="controls">
                    <fmt:formatDate value="${region.lastUpdated}" pattern="yyyy-MM-dd HH:mm:ss"/>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">创建人：</label>
                <div class="controls">
                        ${fns:getUserById(region.createBy.id).name}
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">修改人：</label>
                <div class="controls">
                        ${fns:getUserById(region.updateBy.id).name}
                </div>
            </div>
        </c:if>
        <div class="control-group">
            <label class="control-label" style="color: red;">*温馨提示：</label>
            <div class="controls" style="color: red;">
            请不要添加如&nbsp;北京市&nbsp;上海市的自定义区域 以免系统发生偏差
            </div>
        </div>
        <div class="form-actions">
            <shiro:hasPermission name="sys:region:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
            <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1*${region.historyFlag})"/>
        </div>
	</form:form>
</body>
</html>